<template>
    <div>
      <GoodsList :list="list" :total="total" :brandlist="brandList" @update="getVal">
        <el-pagination
          @size-change="handleSizeChange"
          @current-change="handleCurrentChange"
          :current-page="start"
          :page-sizes="[5, 10, 15, 20]"
          :page-size="limit"
          layout="total, sizes, prev, pager, next, jumper"
          :total="total">
        </el-pagination>
      </GoodsList>
    </div>
</template>

<script>
import {
productsByPage,
findAllBrand
} from "@/api/goodsManage/list"
import GoodsList from "@/components/GoodsList/index.vue"
import mix from "@/mixins"
export default {
  components:{
    GoodsList
  },
  mixins:[mix],
    data() {
        return {
          total:0,
          list:[],
          brandList:[]
        };
    },
    computed: {

    },
      created() {
        this.init();
        findAllBrand()
        .then(res =>{
          this.brandList = res.data.items;
        })
      },
    mounted() {

    },
    methods: {
      getVal(val){
        console.log(val)
        this.formData = val;
        this.init()
      },
      init(){
        productsByPage(this.start,this.limit,this.formData)
        .then(res =>{
          console.log(res)
          this.total = res.data.total;
          this.list = res.data.rows;
        })
      }
    },  
};
</script>

<style scoped lang="scss">

</style>
